﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mayfair.Core.Common.FormManager.FormAttr
{
    /// <summary>
    /// 表示モードタイプ
    /// ModalTypes
    /// </summary>
    public enum FormModalType
    {
        Modal,
        Modeless
    }

    /// <summary>
    /// フォーム生成・表示属性
    /// FormAttributes
    /// </summary>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class FormAttribute : Attribute
    {
        /// <summary>
        /// 遷移先Formクラス
        /// The transited form class property
        /// </summary>
        private readonly Type _type;

        public Type FormType
        {
            get { return _type; }
        }

        /// <summary>
        /// 表示モードタイプ
        /// ModalType
        /// </summary>
        private readonly FormModalType _mode = FormModalType.Modeless;

        public FormModalType Mode
        {
            get { return _mode; }
        }
        
        /// <summary>
        /// 初期処理メソッド名
        /// InitialMethodName
        /// </summary>
        private string _initialMethodName;

        public string InitialMethodName
        {
            get { return _initialMethodName; }
            set { _initialMethodName = value; }
        }

        /// <summary>
        /// 返却値用プロパティ名
        /// Propertyname for Returning
        /// </summary>
        private string _returnPropertyName = string.Empty;

        public string ReturnPropertyName
        {
            get { return _returnPropertyName; }
            set { _returnPropertyName = value; }
        }
        
        // 

        /// <summary>
        /// コンストラクタ
        /// Constructer
        /// </summary>
        /// <param name="type"></param>
        /// <param name="modalType"></param>
        public FormAttribute(Type type, FormModalType modalType)
        {
            this._type = type;
            this._mode = modalType;
        }
        
        /// <summary>
        /// コンストラクタ
        /// Constructer
        /// </summary>
        /// <param name="type"></param>
        /// <param name="modalType"></param>
        /// <param name="initialMethodName"></param>
        public FormAttribute(Type type, FormModalType modalType, string initialMethodName)
        {
            this._type = type;
            this._mode = modalType;
            this._initialMethodName = initialMethodName;
        }

        /// <summary>
        /// コンストラクタ
        /// Constructer
        /// </summary>
        /// <param name="type"></param>
        /// <param name="modalType"></param>
        /// <param name="initialMethodName"></param>
        /// <param name="returnPropertyName"></param>
        public FormAttribute(Type type, FormModalType modalType, string initialMethodName, string returnPropertyName)
        {
            this._type = type;
            this._mode = modalType;
            this._initialMethodName = initialMethodName;
            this._returnPropertyName = returnPropertyName;
        }

    }
}
